/*
 * Copyright (c) 2014. kupat Corporation. All rights reserved.
 *  see statement on http://www.kupat.cn.
 */
package com.kfgj.hkp.common.dataaccess.dialect;

/**
 * Created by liwensihan on 2014/11/8.
 *
 * @author liwensihan
 */
public class PostgreSQLDialect extends AbstractDialect {

    @Override
    public boolean supportsLimit() {
        return true;
    }

    @Override
    public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder) {

        return new StringBuffer(sql.length() + 20)
                .append(sql)
                .append(offset > 0 ? " limit " + limitPlaceholder + " offset "
                        + offsetPlaceholder : " limit " + limitPlaceholder)
                .toString();
    }
}
